# Maintainer: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Streetwalrus <streetwalrus@codewalr.us>

pkgname=shotgun
pkgver=2.5.1
pkgrel=1
pkgdesc='Minimal X screenshot utility'
arch=('loong64' 'x86_64')
url=https://github.com/neXromancers/shotgun
license=('MPL2')
depends=('gcc-libs')
makedepends=('git' 'rust')
optdepends=(
  'hacksaw: for area/window selection'
  'slop: for area/window selection'
)
source=("shotgun-$pkgver.tar.gz::https://static.crates.io/crates/shotgun/shotgun-$pkgver.crate")
b2sums=('fa4259a553528484c8a2d959fff4eac6a608cf4c22c68f4c55326310dd11530c864a13ed927a225706a61bee6a9c5232df12e303c1120833267b284a157e4ad3')

prepare() {
  cd shotgun-$pkgver
#cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd shotgun-$pkgver
  find -name Cargo.lock -exec rm -f {} \;
  mkdir -p .cargo
  cat > .cargo/config.toml <<EOF
[source.crates-io]
registry = "https://gitee.com/yetist/crates.io-index"
EOF
  cargo build --release
}

package() {
  cd shotgun-$pkgver
  install -Dt "$pkgdir"/usr/bin target/release/shotgun
}
